# -*- coding: utf-8 -*-
import requests
import json

api_host = 'https://a1.easemob.com/'
JSON_HEADER = {'content-type': 'application/json'}
# EASEMOB_HOST = "http://localhost:8080"#

app_key = 'xhw0525#my123'
app_credentials = {
    'client_id': 'YXA6vnQ10GbwEeaNUrOwYDD2Pw',
    'client_secret': 'YXA6Dj98aySTDg_NXFQj6nShiV-p-ok'
}

auth_type = 'client_credentials'
org, app = tuple(app_key.split('#'))

payload = {
    "grant_type": "client_credentials",
    "client_id": "YXA6vnQ10GbwEeaNUrOwYDD2Pw",
    "client_secret": "YXA6Dj98aySTDg_NXFQj6nShiV-p-ok"
}


r = requests.post(api_host+org+"/"+app+"/token", data=json.dumps(payload), headers=JSON_HEADER)

print r.content

